<?php
    include '../conexion/Conexion.php';
    $con = new Conexion();
    
    $rol = $_REQUEST['txtRoll'];
    //$sb = $_REQUEST['ch'];
    
    
    $sql = "insert into roll(rol_descripcion)values('".$rol."')";
    $con->query($sql);
    $sql2 = "select rol_oid from roll
             where rol_descripcion ='".$rol."'";
    $respu = $con->query($sql2);
    while($respue = mssql_fetch_array($respu)){
        $roll  = $respue['rol_oid'];
    }
    
    
    
    $lista = $_POST['ch'];
    $n = count($lista);
    $i = 0;

    while ($i < $n)
    {
       $sql3 = "insert into config(rol_oid,sub_oid)values(".$roll.",{$lista[$i]})";
        mssql_query($sql3);
        
      $i++;
    }
    header("location:../../../vista/php/exitoRol.php");
    
    $con->cerrarConexion();
    
?>
